﻿using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using SmartCity.Shared;
using Volo.Abp;
using Volo.Abp.AspNetCore.Mvc;

namespace MetroManagement
{
    /// <summary>
    /// 地铁公告控制器
    /// </summary>
    [RemoteService]
    [Area("metroManagement")]
    [Route("api/metroManagement/notices")]
    public class NoticeController : AbpController, INoticeAppService
    {
        private readonly INoticeAppService _noticeAppService;

        public NoticeController(
            INoticeAppService noticeAppService)
        {
            _noticeAppService = noticeAppService;
        }

        // 分页列表
        [HttpGet]
        [Route("list")]
        public Task<ListResponse<NoticeDto>> PagedListAsync(PagedListRequest request, string title)
        {
            return _noticeAppService.PagedListAsync(request, title);
        }

        // 获取
        [HttpGet]
        [Route("{id:int}")]
        public Task<ResultResponse<NoticeDto>> GetAsync(int id)
        {
            return _noticeAppService.GetAsync(id);
        }
    }
}